<?php
    use User\Model\OptionModel;
?>
<!-- page heading start-->
<div class="page-heading">
    <h3>
        意见箱
    </h3>

</div>
<!-- page heading end-->
<div class="row">
    <div class="col-sm-12">
        <section class="panel">
            <header class="panel-heading">
                <a class="btn btn-default" href="/User/Tool/option">意见箱</a>
                <a class="btn btn-default" href="/User/Tool/option_dept">部门</a>
                <a class="btn btn-default" href="/User/Tool/option_person">员工</a>
            </header>
            <div class="panel-body">
                <table class="table table-hover general-table table-bordered">
                    <thead>
                    <tr>
                        <th width="20%">意见</th>
                        <th width="10%">创建时间</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <?php foreach($view_arr as $val){?>
                    <tr>
                        <td>
                            <span>
                                <?php
                                    echo $val['content'];
                                ?>
                            </span>
                        </td>
                        <td>
                            <span>
                                <?php echo $val['created_date'];?>
                            </span>
                        </td>
                        <td>
                            <a class="btn btn-default" href="#"
                               onclick="<?php echo 'return delete_data(' . $val['view_id'] .')';?>">删除</a>
                        </td>
                    </tr>
                    <?php }?>

                    </tbody>
                </table>
                <div class="pages">
                    {$page}
                </div>
            </div>
        </section>
    </div>
</div>
<script>
    function delete_data(id){
        $.ajax({
            data:{view:id},
            dataType:'json',
            url:'/User/Tool/option_del',
            type:'get',
            success:function(res){
                window.location.reload();
            }
        });
        return false;
    }
</script>